package com.example.administrator.exam;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Toast;

import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.ImageRequest;
import com.android.volley.toolbox.NetworkImageView;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;

import java.util.HashMap;
import java.util.Iterator;

import org.json.JSONException;
import org.json.JSONObject;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;

import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;


public class MainActivity extends AppCompatActivity {
    private LinearLayout layout;
    private RequestQueue mRequestQueue;
    private StringRequest mStringRequest;
    private Context mContext;
    private JsonObjectRequest mJsonObjectRequest;
    private ImageView mImageView;
    private NetworkImageView mNetworkImageView;
    private ListView listView;


    private EditText zhangHaoText;
    private EditText miMaText;
    private Button zhuCeBtn, wangJiMiMaBtn, dengLuBtn;
    private String username, password;
    private String setting;
    //声明一个Volley请求队列
    private RequestQueue requestQueue = null;
    //Get请求方式的URL
    private static final String URL_GET = "http://api.gzkbapp.com/postLogin.action?userName=用户名&userPswd=密码&vrfCd=1&cltId=1";
    //Post请求方式的URL
    private static final String URL_POST = "http://api.gzkbapp.com/postLogin.action?userName=用户名&userPswd=密码&vrfCd=1&cltId=1";
    private android.content.Context context;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        final Button button1 = (Button) this.findViewById(R.id.log);//获取
        zhangHaoText = (EditText) findViewById(R.id.zhangHaoText);
        miMaText = (EditText) findViewById(R.id.miMaText);


        button1.setOnClickListener(new View.OnClickListener() {  //事件
            @Override
            public void onClick(View v) {
                username = zhangHaoText.getText().toString();
                password = miMaText.getText().toString();

                button1.setBackgroundColor(Color.RED);

                if (username.equals("18885089501") && password.equals("qqqqqq")) {

                    Toast.makeText(getApplicationContext(), "请求volley", Toast.LENGTH_SHORT).show();



                    Intent intent2=new Intent();
                    intent2.setClass(getApplicationContext(), GeRenZhongXin.class);
                    startActivity(intent2);


                } else {
                    Toast.makeText(getApplicationContext(), "请求失败", Toast.LENGTH_SHORT).show();
                }


            }
        });





    }

}





